<meta charset="UTF-8" />
<?php
include_once "class/content.php";
include_once "class/db.php";

session_start();

$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['PHP_SELF']);

class util {

    public function loggedIn() {
        if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
            return false;
        }
        return true;
    }

}

$util = new util();
?>
<html>
    <head>
        <link href="css/style.css" type="text/css" rel="stylesheet" /> 
        <link href="css/layout.css" type="text/css" rel="stylesheet" /> 
        <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" ></script> -->
        <script type="text/javascript" src="js/jquery-1.7.1.min.js" ></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script>
        <script type="text/javascript" src="js/switchmenu.js" ></script>  
        <script type="text/javascript" src="js/sphider_ajax.js" ></script>  
        <style type="text/css">
            .menutitle{
                cursor:pointer;
                margin-bottom: 5px;
                background-color:#ECECFF;
                color:#000000;
                width:600px;
                padding:2px;
                text-align:center;
                font-weight:bold;
                /*/*/border:1px solid #000000;/* */
            }

            .submenu{
                margin-bottom: 0.5em;
            }
        </style>

        <script type="text/javascript">


            //Showcase
            $(document).ready(function(){  
                $("#default-packages").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true); 
            });  

            $(document).ready(function(){  
                $("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);  
                $("#featured").hover(  
                function() {  
                    $("#featured").tabs("rotate",0,true);  
                },  
                function() {  
                    $("#featured").tabs("rotate",5000,true);  
                }  
            );  
            });
            //Showcase-end

            //highlighting current site
            window.onload = clearCurrentLink;
            function clearCurrentLink(){
                var nav = document.getElementById("navi");
                var a = nav.getElementsByTagName("A");
                for(var i=0;i<a.length;i++)
                    if(a[i].href == window.location.href.split("#")[0]){
                        changeClass(a[i], "active");
                    }
            }
            function changeClass(elementID, newClass) {
                //var element = document.getElementById(elementID);
                elementID.setAttribute("class", newClass); //For Most Browsers
                elementID.setAttribute("className", newClass); //For IE; harmless to other browsers.
            }
            //highlighting end
        </script>
    </head>
    <body onLoad="clearCurrentLink();">
        <div id="container">
            <div id="header">
                <div id="logo">
                    <img src="" width="100px" height="100px" style="float: left;" />
                    <h1>lastaid</h1>
                    <h2>überbrückt die Durststrecke im Militär</h2>
                </div>
                <div id="meta">
                    <?php
                    if ($util->loggedIn()) {
                        echo '<a href="?pid=101">abmelden</a>';
                    } else {
                        ?>
                        <form method="POST" action="?pid=100">
                            <input type="text" value="username" name="username" id="login-username" onFocus="if(this.value=='username'){this.value=''}"/><input type="password" name="passwort" value="passwort" onFocus="this.value=''""/><input type="submit" value="login" /></form>
                        <a href="?pid=91">registrieren</a></br>

                        <?php
                    }
                    ?>
                    <form method="GET" action="">
                        <input type="text" value="autocomplete" id="searchinput"/><input type="submit" id="searchbutton" value="suchen"/>
                    </form>
                </div>
            </div>
            <div id="navi">
                <ul>
                    <?php
                    if ($util->loggedIn()) {
                        ?>
                        <li><a href="?pid=50">einkaufen</a></li>
                        <li><a href="?pid=51">verpacken</a></li>
                        <li><a href="?pid=52">stats</a></li>
                        <li><a href="?pid=53">admin</a></li>
                        <?php
                    } else {
                        ?>
                        <li><a href="?pid=1">home</a></li>
                        <li><a href="?pid=2">shop</a></li>
                        <li><a href="?pid=3">standart-päckli</a></li>
                        <li><a href="?pid=4">kontakt</a></li>
    <?php
}
?>
                </ul>
            </div>
            <div id="feedback">
                <a href="#"></a>
            </div>

            <div id="resultcontainer"> 
            </div> 
            <div id="content">
                <?php
                $content = new content();
                $content->display();
                ?>
            </div>
            <div id="footer">
                <p style="">AGBs</p>
            </div>
    </body>
</html>